﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace DocumentInterchange.Models
{
	public class UsersContext : DbContext
	{
		public UsersContext()
			: base("DefaultConnection")
		{
		}

		public DbSet<UserProfile> UserProfiles { get; set; }
	}

	public class ClientContext : DbContext
	{
		public ClientContext()
			: base("DefaultConnection")
		{
		}

		public DbSet<Client> Clients { get; set; }
		public DbSet<Company> Companies { get; set; }
	}

	[Table("UserProfile")]
	public class UserProfile
	{
		[Key]
		[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
		public int UserId { get; set; }
		public string UserName { get; set; }
	}

	[Table("Clients")]
	public class Client
	{
		[Key]
		[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
		public int Id { get; set; }
		public int UserId { get; set; }
		public string Name { get; set; }
		public string Position { get; set; }
		public int Company { get; set; }
		public int Departament { get; set; }
		public int Sertificate { get; set; }
	}

	[Table("Companies")]
	public class Company
	{
		[Key]
		[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
		public int Id { get; set; }
		public string CompanyName { get; set; }
		public long INN { get; set; }
		public long KPP { get; set; }
	}

	public class LoginModel
	{
		[Required]
		[Display(Name = "Логин")]
		public string UserName { get; set; }

		[Required]
		[DataType(DataType.Password)]
		[Display(Name = "Пароль")]
		public string Password { get; set; }

		[Display(Name = "Запомнить меня?")]
		public bool RememberMe { get; set; }
	}
}